﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace BSCMFF.Web.UserControls.Selections
{
    /// <summary>
    /// Evaluation selection.
    /// </summary>
    /// <remarks></remarks>
    public partial class EvaluationSelection : System.Web.UI.UserControl
    {
        /// <summary>
        /// Gets or sets the public selected value.
        /// </summary>
        /// <value>The public selected value.</value>
        /// <remarks></remarks>
        public int PublicSelectedValue
        { 
            get
            {
                if (RadComboBoxEvaluations.SelectedValue == "")
                {
                    return 0;
                }
                else
                {
                    return Int32.Parse(RadComboBoxEvaluations.SelectedValue);
                }
   
            }
            set
            {
                if (value != 0)
                {
                    RadComboBoxEvaluations.SelectedValue = value.ToString();
                }
            }
        }

        /// <summary>
        /// Gets the public selected evaluation period.
        /// </summary>
        /// <remarks></remarks>
        public string PublicSelectedEvaluationPeriod 
        { 
            get
            {
                return RadComboBoxEvaluations.SelectedItem.Text;   
            }
        }

        /// <summary>
        /// Occurs when [evaluation selected index changed].
        /// </summary>
        /// <remarks></remarks>
        public event EventHandler EvaluationSelectedIndexChanged;

        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// Handles the SelectedIndexChanged event of the RadComboBoxEvaluations control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void RadComboBoxEvaluations_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (EvaluationSelectedIndexChanged != null)
            {
                EvaluationSelectedIndexChanged(this, e);
            }
        }
    }
}